﻿using UnityEngine;

namespace Core
{
    [DisallowMultipleComponent]
    public class RGMono : MonoGO
    {
        ReferenceGroup referenceGroup;
        ReferenceGroup RG
        {
            get
            {
                if (referenceGroup == null)
                    referenceGroup = GetComponent<ReferenceGroup>();
                if (referenceGroup == null)
                    referenceGroup = gameObject.AddComponent<ReferenceGroup>();

                return referenceGroup;
            }
        }

        public GameObject GetReference(string goName)
        {
            return RG.GetReference(goName);
        }

        public T GetReference<T>(string goName) where T : Component
        {
            return RG.GetReference<T>(goName);
        }
    }
}
